<template>
  <div id="app">
    <red-box>
      hello1111
    </red-box>
    <div class="top">
      <div class="item"
           :class="[type==='goods'?'changGreen':'']"
           @click="onBn('goods')">商品</div>
      <div class="item"
           :class="[type==='evaluate'?'changGreen':'']"
           @click="onBn('evaluate')">评价</div>
      <div class="item"
           :class="[type==='sku'?'changGreen':'']"
           @click="onBn('sku')">规格</div>
    </div>
    <div>
      <component :is="type"></component>
    </div>
  </div>
</template>

<script>
import redBoxVue from './components/redBox.vue';
import goods from './components/goods.vue';
import evaluate from './components/evaluate.vue';
import sku from './components/sku.vue';
export default {
  name: 'App',
  components: {
    'red-box': redBoxVue,
    goods, evaluate, sku
  },
  data () {
    return {
      type: 'goods'
    }
  },
  methods: {
    onBn (val) {
      this.type = val
    }
  }
}
</script>

<style lang="less">
.top {
  height: 50px;
  line-height: 50px;
  width: 300px;
  background: pink;
  display: flex;
  text-align: center;
  .item {
    flex: 1;
  }
}
.changGreen {
  background-color: green;
}
</style>
